package com.boss.salary.dao;

import com.boss.framework.dto.PaginationDTO;
import com.boss.salary.entity.AgencySalary;
import com.boss.salary.entity.SalaryHistory;
import com.boss.salary.entity.SalaryMonthEnd;
import com.boss.salary.vo.AgencySalaryVO;
import com.boss.sys.ca.user.dto.UserDTO;

import java.lang.reflect.InvocationTargetException;
import java.util.List;
import java.util.Map;

public interface IAgencySalaryDao {

    /**
     * 分页查询 工资项与机构挂接表数据
     * @param paginationDTO
     * @return
     */
    List<AgencySalary> queryAgencySalaryPage(PaginationDTO paginationDTO);

    /**
     * 获取工资项与机构挂接表数据数量
     * @return
     */
    int queryAgencySalaryTotal();

    /**
     * 增加 工资项与机构挂接表数据
     * @param agencySalary
     * @return
     */
    void saveAgencySalary(AgencySalary agencySalary);

    /**
     * 更新 工资项与机构挂接表数据
     * @param agencySalary
     * @return
     */
    void updateAgencySalary(AgencySalary agencySalary);

    /**
     * 根据id删除工资项与机构挂接表数据
     * @param id
     * @return
     */
    void deleteAgencySalary(String id);

    /**
     * 根据条件查询 单位与工资项挂接数据
     * @param queryParam
     * @return
     */
    List<AgencySalary> queryAgencySalaryInfo(Map<String, Object> queryParam);

    /**
     * 根据条件物理删除 单位与工资项挂接数据
     * @param queryParam
     */
    void physicsDeleteAgencySalary(Map<String, Object> queryParam);

    /**
     * 条件查询 当月工资各项合计
     * @param agencyId
     * @param queryColumn
     * @param condition
     * @return
     */
    Map<String, Object> selectSalaryMonthEndSum(String agencyId,
                                                Integer queryThirteen,
                                                List<String> queryColumn,
                                                Map<String, Object> condition,String mofDivCode);

    /**
     * 分页查询 单位工资编报
     * @param paginationDTO 分页
     * @param agencyId 机构id
     * @param salaryIds 当月工资字段id
     * @param currentSalaryIdJoinColumnMap 获取当月salaryID对应字段名map
     * @param condition 查询条件
     * @return
     */
    List<Map<String,Object>> selectUnitSalaryReportPage(PaginationDTO paginationDTO,
                                                      String agencyId,
                                                      List<String> salaryIds,
                                                      String salaryMonth,
                                                      Map<String, String> currentSalaryIdJoinColumnMap,
                                                      Map<String, Object> condition,String mofDivCode);

    /**
     * 查询工资变动人数
     * @param agencyId
     * @param salaryIds
     * @param currentSalaryIdJoinColumnMap
     * @param lastSalaryIdJoinColumnMap
     * @param queryParam
     * @return
     */
    int selectSalaryChangePersonNum(String agencyId, List<String> salaryIds,
                                    String salaryMonth,
                                    String lastSalaryMonth,
                                      Map<String, String> currentSalaryIdJoinColumnMap,
                                      Map<String, String> lastSalaryIdJoinColumnMap,
                                      Map<String, Object> queryParam);
    /**
     * 查询上报的工资变动人数
     * @param agencyId
     * @param salaryIds
     * @param currentSalaryIdJoinColumnMap
     * @param lastSalaryIdJoinColumnMap
     * @param queryParam
     * @return
     */
    int selectSalaryChangePersonNumOnSubmit(String agencyId, List<String> salaryIds,
                                            String salaryMonth,
                                            String lastSalaryMonth,
                                            Map<String, String> currentSalaryIdJoinColumnMap,
                                            Map<String, String> lastSalaryIdJoinColumnMap,
                                            Map<String, Object> queryParam);
    /**
     * 分页查询 单位审核
     * @param paginationDTO 分页
     * @param agencyId 机构id
     * @param salaryIds 当月工资字段id
     * @param currentSalaryIdJoinColumnMap 获取当月salaryID对应字段名map
     * @param condition 查询条件
     * @return
     */
    List<Map<String,Object>> selectUnitAuditPage(PaginationDTO paginationDTO,
                                                        String agencyId,
                                                        List<String> salaryIds,
                                                         String salaryMonth,
                                                        Map<String, String> currentSalaryIdJoinColumnMap,
                                                        Map<String, Object> condition,String mofDivCode);


    /**
     * 查询 某人上月工资月结数据
     * @param agencyId
     * @param queryColumn
     * @return
     */
    SalaryHistory selectSalaryHistoryDataByPersonId(String agencyId,
                                                    String personId,
                                                    String lastSalaryMonth,
                                                    List<String> queryColumn) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException;

    /**
     * 获取单位工资编报数据数量
     * @return
     */
    int selectUnitSalaryReportTotal(String agencyId, Map<String,Object> condition,String mofDivCode);

    /**
     * 获取单位审核数据数量
     * @return
     */
    int selectUnitAuditTotal(String agencyId, Map<String,Object> condition,String mofDivCode);


    /**
     * 分页查询 单位工资上报数据合计值
     * @param queryParam
     * @return
     */
    Map<String, Object> selectUnitSalarySubmitReportSum(String agencyId, List<String> salaryIds,
                                                              String salaryMonth, Map<String, String> currentSalaryIdJoinColumnMap,
                                                              Map<String, Object> queryParam);
    /**
     * 分页查询 单位工资上报数据
     * @param paginationDTO
     * @param queryParam
     * @return
     */
    List<Map<String,Object>> selectUnitSalarySubmitReportPage(PaginationDTO paginationDTO, String agencyId, List<String> salaryIds,
                                                              String salaryMonth, Map<String, String> currentSalaryIdJoinColumnMap,
                                                              Map<String, Object> queryParam);

    /**
     * 获取单位工资上报数据数量
     * @return
     */
    int selectUnitSalarySubmitReportTotal(String agencyId, String lastSalaryMonth, Map<String, Object> queryParam);

    /**
     * 首页查询单位上报数量
     * @param agencyId
     * @param queryParam
     * @return
     */
    int selectHomeUnitSalaryReportTotal(String agencyId, Map<String, Object> queryParam);

    /**
     * 动态查询工资编报表头
     * @param agencyId
     * @return
     */
    List<Map<String,Object>> selectSalaryName(String agencyId);

    /**
     * 获取当月工资字段
     * @param userDTO
     * @return
     */
    List<AgencySalaryVO> selectColumnName(UserDTO userDTO);

    /**
     * 获取当月工资字段名
     * @param userDTO
     * @return
     */
    List<AgencySalaryVO> selectColumnName(UserDTO userDTO, List<String> salaryCodeList);

    /**
     * 获取上月工资字段
     * @param agencyId
     * @return
     */
    List<AgencySalaryVO> selectLastColumnName(String agencyId, List<String> salaryIds, String lastSalaryMonth);

    /**
     * 获取实发工资字段名
     * @param agencyId
     * @return
     */
    String selectReallySendSalaryColumnName(String agencyId);

    /**
     *  根据单位id批量获取工资单位挂接数据
     * @param agencyIds
     * @return
     */
    List<AgencySalary> getInfoByAgencyIds(List<String> agencyIds);


    /**
     * 批量插入单位工资挂接历史表
     * @param params
     */
    void batchSaveAgencySalaryHistory(List<Object[]> params);

    /**
     * 删除历史表数据
     * @param month
     * @param agencyIds
     */
    void deleteAgencySalaryHistory(String month, List<String> agencyIds);

    /**
     * 根据单位id和人员id获取工资信息
     * @param columnName
     * @param agencyId
     * @param personId
     * @return
     */
    List<SalaryMonthEnd> getSalaryMonthByPersonId(List<String> columnName, String agencyId, String personId);

    /**
     * 根据单位id和人员id获取工资信息
     * @param columnName
     * @param agencyId
     * @param personId
     * @return
     */
    List<SalaryMonthEnd> getSalaryMonthEedSubmitByPersonId(List<String> columnName, String agencyId, String personId);


    /**
     * 导出查询工资所有数据
     * @param agencyId
     * @param salaryIds
     * @param currentSalaryIdJoinColumnMap
     * @param condition
     * @return
     */
    List<Map<String,Object>> getSelectUnitSalaryReport(   String agencyId,
                                                          List<String> salaryIds,
                                                          Map<String, String> currentSalaryIdJoinColumnMap,
                                                          Map<String, Object> condition,String datatype);


    /**
     * 分页查询 单位上报数据
     * @param paginationDTO 分页
     * @param agencyId 机构id
     * @param salaryIds 当月工资字段id
     * @param currentSalaryIdJoinColumnMap 获取当月salaryID对应字段名map
     * @param condition 查询条件
     * @return
     */
    List<Map<String,Object>> getFinancialAuditSalaryPage(PaginationDTO paginationDTO,
                                                 String agencyId,
                                                 List<String> salaryIds,
                                                 String salaryMonth,
                                                 String lastSalaryMonth,
                                                 Map<String, String> currentSalaryIdJoinColumnMap,
                                                 Map<String, Object> condition,String mofDivCode,
                                                         String flag);

    /**
     * 获取单位上报数据数量
     * @return
     */
    int selectFinancialAuditSalaryTotal(String agencyId, String lastSalaryMonth, Map<String,Object> condition,String mofDivCode,String flag);

    /**
     * 条件查询 当月上报工资各项合计
     * @param agencyId
     * @param queryColumn
     * @param condition
     * @return
     */
    Map<String, Object> selectSalaryMonthEndSubmSum(String agencyId,
                                                Integer queryThirteen,
                                                List<String> queryColumn,
                                                Map<String, Object> condition,String mofDivCode,String flag);

}
